package felix.things.router;

import felix.things.router.modbus.mapping.TypeTagMapping;
import felix.things.router.modbus.response.ModBusDataProcessor;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * @author Felix
 * @date 2019/10/31
 **/
@Component
public class ModBusDataPrint implements ModBusDataProcessor {
    @Override
    public String getTag() {
        return "udp:a1";
    }

    @Override
    public List<TypeTagMapping> getMappings() {
        List<TypeTagMapping> mappings = new ArrayList<>();
        mappings.add(new TypeTagMapping("t50", 50));
        mappings.add(new TypeTagMapping("t1", 1));
        mappings.add(new TypeTagMapping("t2", 2));
        mappings.add(new TypeTagMapping("t3", 3));
        return mappings;
    }

    @Override
    public void processorData(String tag, HashMap<String, Object> response, int start, int end) {
        System.out.println(tag + "  " + response);
    }

}
